function checkboxAction() {
	document.getElementById("allSltChk").onclick = function() {

		var flag = this.checked;
		var items = document.getElementsByName("singleSelectChk");
		for (var i = 0; i < items.length; i++) {
			items[i].checked = flag;
		}
		document.getElementById("allCancleChk").checked=false;
		document.getElementById("allRevesalChk").checked=false;
	}
	var items = document.getElementsByName("singleSelectChk");
	for (var i = 0; i < items.length; i++) {
		items[i].onclick = function() {
			document.getElementById("allCancleChk").checked=false;
			var number = 0;
			var items = document.getElementsByName("singleSelectChk");
			for (var j = 0; j < items.length; j++) {
				if (items[j].checked) {
					number++;
				}
			}
			document.getElementById("allSltChk").checked = (items.length == number);
		}
	}
	document.getElementById("allCancleChk").onclick = function() {
		var items = document.getElementsByName("singleSelectChk");
		for (var i = 0; i < items.length; i++) {
			items[i].checked = false;
		}
		document.getElementById("allSltChk").checked=false;
		document.getElementById("allRevesalChk").checked=false;
	}
	document.getElementById("allRevesalChk").onclick = function() {
		var number = 0;
		var items = document.getElementsByName("singleSelectChk");
		for (var i = 0; i < items.length; i++) {
			items[i].checked = !items[i].checked ;
			if(items[i].checked){
				number++;
			}
		}
		document.getElementById("allSltChk").checked = (items.length == number);
		document.getElementById("allCancleChk").checked=false;
		
	}
}

function XMLStrCreate(){
	var xmlStrHeader="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + 
	  "<Command>" + 
	  "<SysName>路径行为查询系统</SysName>"+ 
	  "<SysID>001</SysID>" + 
	  "<FunName>智能回放</FunName>" + 
	  "<FunID>101</FunID>" + 
	  "<NoteList>";
	var xmlBody="";
	var xmlBody1="";
	var xmlBody2="";
	var xmlStrFooter="</NoteList> </Command>";
	var items = document.getElementsByName("singleSelectChk");
	var tempValue="";
	var tempArray;
	var rowNum=0;
	for (var i = 0; i < items.length; i++) {
		if(items[i].checked){
			rowNum=rowNum+1
			tempArray="";
			tempValue=document.getElementById("XmlStrId"+i).value;
			tempArray=tempValue.split("@;@");
			xmlBody1=
			"<Note>" + 
			"<NoteID>" + tempArray[0] + "</NoteID>" + 
			"<NoteName>"+tempArray[1] + "</NoteName>" + 
			"<NotesDesc>" + tempArray[2] + "</NotesDesc>"+ 
			"<CamCount>" + tempArray[3] + "</CamCount>" + 
			"<CamName1>" + tempArray[4] + "</CamName1>";
			
			if(tempArray.length!=11){
				xmlBody1=xmlBody1+"<CamName2>" + tempArray[5] + "</CamName2>";
			}
			
			if(tempArray.length==12){
			xmlBody2=
			"<Year>" + tempArray[6] + "</Year>" + 
			"<Month>" + tempArray[7]+ "</Month>" + 
			"<Day>" + tempArray[8] + "</Day>" + 
			"<Hour>" + tempArray[9] + "</Hour>" + 
			"<Minute>" + tempArray[10]+ "</Minute>" + 
			"<Second>" + tempArray[11] + "</Second>" + 
			"<TimeLength>20</TimeLength>"+ 
			"</Note>";
			}else if(tempArray.length==11){
			xmlBody2=
			"<Year>" + tempArray[5] + "</Year>" + 
			"<Month>" + tempArray[6]+ "</Month>" + 
			"<Day>" + tempArray[7]+ "</Day>" + 
			"<Hour>" + tempArray[8] + "</Hour>" + 
			"<Minute>" + tempArray[9]+ "</Minute>" + 
			"<Second>" + tempArray[10] + "</Second>" + 
			"<TimeLength>20</TimeLength>"+ 
			"</Note>";
			}else{
			xmlBody2=
			"<CamName3>" + tempArray[6] + "</CamName3>"+ 
			"<Year>" + tempArray[7] + "</Year>" + 
			"<Month>" + tempArray[8]+ "</Month>" + 
			"<Day>" + tempArray[9] + "</Day>" + 
			"<Hour>" + tempArray[10] + "</Hour>" + 
			"<Minute>" + tempArray[11]+ "</Minute>" + 
			"<Second>" + tempArray[12] + "</Second>" + 
			"<TimeLength>"+tempArray[13]+"</TimeLength>"+ 
			"</Note>";
			}
			xmlBody=xmlBody+xmlBody1+xmlBody2;
			
		}
	}
	if(rowNum==0){//未checked不发送数据
		alert("未选择记录！");
		return "0";
	}
	
	return xmlStrHeader+ xmlBody+xmlStrFooter;
	  
};
//跨域访问
function SendXMLToOtherServer(serverURL){
	var xmlData;
	xmlData=XMLStrCreate();
	if(xmlData=="0"){
		return;
	}
	var xmlhttp=new XMLHttpRequest();
	//默认UTF-8
	xmlhttp.open("POST",serverURL,true);
	xmlhttp.send(xmlData);

};
//警员授权询问室 撤销授权,根据url 区分是否授权还是撤销
function ploiceAuth(serverURL,iCardNo,iAccessSn,iDoorNo){
	//alert(serverURL);
	if (typeof(iAccessSn)=="undefined"){
		iAccessSn="";
	}
	if (typeof(iDoorNo)=="undefined"){
		iDoorNo="";
	}
	
	var sendData="{CardNo:'"+iCardNo+"',AccessSn:'"+iAccessSn+"',DoorNo:'"+iDoorNo+"'}"
	//alert(sendData);
	//alert(sendData)
	//alert(serverURL)
	var xmlhttp=new XMLHttpRequest();
	//默认UTF-8
	xmlhttp.open("POST",serverURL,true);
	xmlhttp.send(sendData);
}
//根据名称获取询问室信息
function getRoomInfoByName(url,roomName){
	var returnresult
	$.ajax({
		url:url,
		type:"post",
	     cache:false, 
	      async:false, 
		data:{'roomName':roomName},
		success:function(result){
			returnresult=result
		},
		error:function(){
			alert("获取询问室信息失败")
		}
	});
	return returnresult;
}
//根据id获取警员信息
function getPoliceById(url,infoGUID){
	var returnresult
	$.ajax({
		url:url,
		type:"post",
	     cache:false, 
	      async:false, 
		data:{'infoGUID':infoGUID},
		success:function(result){
			returnresult=result
		},
		error:function(){
			alert("获取警员信息失败")
		}
	});
	return returnresult;
}
//读取身份证信息，返回json
//{ "Name": "刘锐", "Sex": "男", "Nation": "汉", "Birthday": "19860321", 
//"Address": "山东省高唐县清平镇刘庄村4164号", "IDCode": "371526198603210413", 
//"Department": "高唐县公安局 ", "StartDate": "20160401", "EndDate": "20360401" }
function getIdCardInfo(url){
	var returnresult
	$.ajax({
		url:url,
		type:"get",
	    cache:false, 
	    jsonp: "callback",
        jsonpCallback:"callbackHandler123",
	    async:false,
	    dataType: 'jsonp',
		success:function(result){
			alert(result)
//			var bhg=JSON.stringify(result) 
//			returnresult=bhg
		},
		error:function(){
			alert("获取身份证信息失败");
		}
	});
/*	var xmlhttp=new XMLHttpRequest();
	//默认UTF-8
	xmlhttp.open("POST",url,true);
	xmlhttp.onreadystatechange = function(){
        if(this.readyState == 4){
            alert(this.responseText);
            returnresult=eval('('+ this.responseText +')');
            
        }
    }
	xmlhttp.send(null);*/
	return returnresult;
}
//客户端回调
function callbackHandler123(json) {
	//var bhg=JSON.stringify(json) 
	alert("1212");
}